package com.ctshk.rpc.finance.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ctshk.rpc.finance.base.CustomBaseMapper;
import com.ctshk.rpc.finance.dto.customer.CustomDataDetailCountDTO;
import com.ctshk.rpc.finance.entity.FinanceCustomerDataDetail;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 客商期初明细 Mapper 接口
 * </p>
 *
 * @author 叶冠峰
 * @since 2021-04-06
 */
public interface FinanceCustomerDataDetailMapper extends CustomBaseMapper<FinanceCustomerDataDetail> {

    /**
     * 期初币种统计
     * @param id
     * @return
     */
    @Select("SELECT receivable_amount,received_amount,uncollected_amount,currency_name\n" +
            "FROM t_finance_customer_data_detail\n" +
            "WHERE data_id = #{data_id} AND is_deleted = 0\n" +
            "GROUP BY currency_id")
    List<CustomDataDetailCountDTO> queryListByCustom(@Param("data_id") Long id);
}
